#define _CRT_SECURE_NO_WARNINGS 1
#include "stdio.h"

int size = 100;

//插入排序
void InsertSort(int arr[], int n)
{
	for (int i = 1;i < n;i++)
	{
		int end = i;
		int tmp = arr[end];
		while (end >= 0)
		{
			if (0 == end)
			{
				arr[end] = tmp;
				break;
			}
			arr[end] = arr[end - 1];
			if (tmp > arr[end])
			{
				arr[end] = tmp;
				break;
			}
			else
				--end;
		}
	}
}
int main()
{
	srand(time(0));
	FILE* p = NULL;
	int num = 3;
	char str[] = { 'a','s','v','\0' };
	//p = fopen("mfile.txt", "w");
	p = fopen("mfile.txt", "r");
	if (!p)
	{
		perror("fopen error");
		return 1;
	}
	//fprintf(p, "num = %d\n", num);
	//fprintf(p, "%s", str);
	/*while (size--) //刚开始创建mfile.txt文件文件，并向里面插入100个[0,99]的随机数
	{
		fprintf(p, "%d\n", rand()%100);
	}*/
	int judge = 0;
	int arr[] = { 2,0,8,1,4};
	for (int i = 1;i <= 100;i++)
	{
		fscanf(p, "%d", &judge);
		if (judge > arr[0])
			arr[0] = judge;
		InsertSort(arr, sizeof(arr) / sizeof(int));
	}
	fclose(p);
	//int arr[] = { 2,0,8,1,4,2 };
	//InsertSort(arr, sizeof(arr) / sizeof(int));
	/*for (int i = 0;i < sizeof(arr) / sizeof(int);++i)
	{
		printf("%d ", arr[i]);
		printf("\n");
	}*/

	int a = -5;
	printf("%d\n", a%2);
	//关于模运算：if(a<0 || b<0)(也就是被除数a必须小于0最后模运算结果才是小于0的，对于除数b可以>于0，也可以小于0) a%b<0   if(a>0 && b<0)  a%b>0
	return 0;
}